- page_title    '新项目'
- header_title  "项目", root_path

%h3.page-title
  新项目
%hr

.project-edit-container
  .project-edit-errors
    = render 'projects/errors'
  .project-edit-content

    = form_for @project, html: { class: 'new_project form-horizontal js-requires-input' } do |f|
      .form-group.project-name-holder
        = f.label :path, class: 'control-label' do
          项目路径
        .col-sm-10
          .input-group
            - if current_user.can_select_namespace?
              .input-group-addon
                = root_url
              = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user, display_path: true), {}, {class: 'select2 js-select-namespace', tabindex: 1}
              .input-group-addon
                \/
            - else
              .input-group-addon
                #{root_url}#{current_user.username}/
            = f.text_field :path, placeholder: "my-awesome-project", class: "form-control", tabindex: 2, autofocus: true, required: true

          - if current_user.can_create_group?
            .help-block
              希望将几个相关联的项目放置于同一个命名空间下？
              = link_to "创建群组", new_group_path

      - if import_sources_enabled?
        .project-import.js-toggle-container
          .form-group
            %label.control-label 导入项目
            .col-sm-10
              - if github_import_enabled?
                - if github_import_configured?
                  = link_to status_import_github_path, class: 'btn import_github' do
                    %i.fa.fa-github
                    GitHub
                - else
                  = link_to '#', class: 'how_to_import_link btn import_github' do
                    %i.fa.fa-github
                    GitHub
                  = render 'github_import_modal'

              - if bitbucket_import_enabled?
                - if bitbucket_import_configured?
                  = link_to status_import_bitbucket_path, class: 'btn import_bitbucket', "data-no-turbolink" => "true" do
                    %i.fa.fa-bitbucket
                    Bitbucket
                - else
                  = link_to status_import_bitbucket_path, class: 'how_to_import_link btn import_bitbucket', "data-no-turbolink" => "true" do
                    %i.fa.fa-bitbucket
                    Bitbucket
                  = render 'bitbucket_import_modal'

              - if gitlab_import_enabled?
                - if gitlab_import_configured?
                  = link_to status_import_gitlab_path, class: 'btn import_gitlab' do
                    %i.fa.fa-heart
                    GitLab.com
                - else
                  = link_to status_import_gitlab_path, class: 'how_to_import_link btn import_gitlab' do
                    %i.fa.fa-heart
                    GitLab.com
                  = render 'gitlab_import_modal'

              - if gitorious_import_enabled?
                = link_to new_import_gitorious_path, class: 'btn import_gitorious' do
                  %i.icon-gitorious.icon-gitorious-small
                  Gitorious.org

              - if google_code_import_enabled?
                = link_to new_import_google_code_path, class: 'btn import_google_code' do
                  %i.fa.fa-google
                  Google 代码

              - if fogbugz_import_enabled?
                = link_to new_import_fogbugz_path, class: 'btn import_fogbugz' do
                  %i.fa.fa-bug
                  Fogbugz

              - if git_import_enabled?
                = link_to "#", class: 'btn js-toggle-button import_git' do
                  %i.fa.fa-git
                  %span 其他仓库的链接

          .js-toggle-content.hide
            = render "shared/import_form", f: f

      .prepend-botton-10

      .form-group
        = f.label :description, class: 'control-label' do
          描述
          %span.light (可选)
        .col-sm-10
          = f.text_area :description, class: "form-control", rows: 3, maxlength: 250, tabindex: 3
      = render 'shared/visibility_level', f: f, visibility_level: default_project_visibility, can_change_visibility_level: true, form_model: @project

      .form-actions
        = f.submit '创建项目', class: "btn btn-create project-submit", tabindex: 4
        = link_to '取消', dashboard_projects_path, class: 'btn btn-cancel'

.save-project-loader.hide
  .center
    %h2
      %i.fa.fa-spinner.fa-spin
      正在创建项目 &amp; 版本库。
    %p 请稍候，页面会处理完成后自动刷新。

:javascript
  $('.how_to_import_link').bind('click', function (e) {
    e.preventDefault();
    var import_modal = $(this).next(".modal").show();
  });
  $('.modal-header .close').bind('click', function() {
    $(".modal").hide();
  });
